package com.woniuxy.direct.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 马宇航
 * @Description: 直接完全匹配
 * @DateTime: 22/12/29/0029 16:18
 * @Component: 成都蜗牛学苑
 **/
@Configuration
public class DirectConfig {
    @Bean //生成bean对象的时候，会使用方法名字作为bean的名字
    public Queue directQueue1(){
        return new Queue("DirectQueue1");
    }
    @Bean
    public Queue directQueue2(){
        return new Queue("DirectQueue2");
    }
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directEx");
    }
    @Bean
    public Binding bindingDirect1(){
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("orange");
    }
    @Bean
    public Binding bindingDirect2(){
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("black");
    }
    @Bean
    public Binding bindingDirect3(){
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("green");
    }
}
